<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/1/26
  Time: 20:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>类型管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layui/css/layui.css"  media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<script src="../../layui/layui.js" charset="utf-8"></script>
<script src="/js/jquery-3.4.1.js" charset="utf-8"></script>
<script src="/js/common.js" charset="utf-8"></script>
<body style="padding: 10px;background-color: rgb(236,240,245);">
    <h1 style="margin-bottom: 20px;">类型管理</h1>
    <input id="pageType" value="${pageType}" style="display: none">
    <!-- 表单区+返回按钮 -->
    <div style="background-color: white;">
        <div class="layui-row">
            <!-- 返回按钮 -->
            <div class="layui-col-xs1" style="padding-left: 10px;padding-top: 10px;">
                <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="location.href = '/jsp/systemManage/typeManage.jsp'">
                    <i class="layui-icon layui-icon-left">返回</i>
                </button>
            </div>
        </div>
        <!-- 蓝色分割线 -->
        <hr class="layui-bg-blue">
        <form id="frm_type" class="layui-form layui-form-pane" action="" style="padding-left: 110px;">
            <input name="dictionary_id" value="${dictionary.dictionary_id}" style="display: none">
            <!-- 第一排 -->
            <div class="layui-form-item">
                <div class="layui-inline" style="width: 45%">
                    <label class="layui-form-label">模块名称</label>
                    <div class="layui-input-block">
                        <input name="dictionary_field" required  lay-verify="required" value="${dictionary.dictionary_field}" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" style="width: 45%">
                    <label class="layui-form-label">类型</label>
                    <div class="layui-input-block">
                        <input name="dictionary_type" required  lay-verify="required" value="${dictionary.dictionary_type}" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <!-- 第二排 -->
            <div class="layui-form-item">
                <div class="layui-inline" style="width: 45%">
                    <label class="layui-form-label">真实值</label>
                    <div class="layui-input-block">
                        <input id="dictionary_fieldValue" name="dictionary_fieldValue" required  lay-verify="required|number" value="${dictionary.dictionary_fieldValue}" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" style="width: 45%">
                    <label class="layui-form-label">显示值</label>
                    <div class="layui-input-block">
                        <input name="dictionary_value" required  lay-verify="required" value="${dictionary.dictionary_value}" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <!-- 功能按钮 -->
            <div class="layui-form-item" style="padding: 15px 0;">
                <div class="layui-inline">
                    <button class="layui-btn" lay-submit lay-filter="submitBtn">保存</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</body>
<script>
    $(function () {
        var pageType = $("#pageType").val();//获取页面类型：1-修改
        if (pageType == 1){
            $("#dictionary_fieldValue").attr("disabled",true);
            $("#dictionary_fieldValue").addClass(" layui-disabled");
        }
    })
    //form模块
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(submitBtn)', function(data){

            var pageType = $("#pageType").val();//获取页面类型：1-修改
            if (pageType == 1){

                $("#frm_type").attr("action","/typeManage/updateDictionaryById.do");
            }else {

                $("#frm_type").attr("action","/typeManage/addDictionary.do");
            }
            return true;
        });
    });
</script>
</html>
